const {mysql} = require('../qcloud')

module.exports = async (ctx) => {
  let {openid,bookid,comment,location,phone} = ctx.request.body
  try{
    await mysql('comment').insert({
      openid,bookid,comment,location,phone
    })
    ctx.state.data={
      msg:'success'
    }
  }catch(e) {
    ctx.state = {
      code: -1,
      msg:'评论失败' + e.sqlMessage
    }
  }
}